﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CallMVC.Models.LoginModel>" %>


<asp:Content ID="calcInputTitle" ContentPlaceHolderID="Title" runat="server">
    Output Result
</asp:Content>

<asp:Content ID="CalcInputContent" ContentPlaceHolderID="MainContent" runat="server">
    <% using (Html.BeginForm())
       { 
    %>
        <%: Html.ValidationSummary()%>

    <ul data-role="listview" data-inset="true">
    <li data-role="fieldcontain"> Calculation : <%: Html.Label(((DBManager.Calculation)this.ViewBag.Calculation).CalculationID)%> </li> 
    </ul>

    <%
            DBManager.Calculation calc = (DBManager.Calculation)this.ViewBag.Calculation;
            string myOrderId = (string)this.ViewBag.OrderId;

            foreach (DBManager.OutputDesignGroup group in calc.OutputDesignGroupsList)
            {
                //foreach (DBManager.OutputDesign design in group.outputDesignList)
                {
    %>
    <ul data-role="listview" data-inset="true">
    <li data-role="fieldcontain">
    <table summary="This table lists is Output of Calculation"> 
      <caption><b><%: Html.Label(group.grpName)%></b></caption> 
      <!--
      <thead> 
        <tr>
        --> 
    <%  
                    //if (design.OutputColumnList.Count == 0)
                    { 
    %>
            <!--
            <th scope="col"></th>  
            <th scope="col"></th>
            -->
    <% 
                    }
                    //else
                    {
    %>
            <!--
            <th scope="col"></th>
            -->

    <%
                        //foreach (DBManager.OutputColumn item in design.OutputColumnList)
                        {
    %>
            <!--
            <th scope="col">
            -->
    <%//: Html.Label(item.Headline)%>
            <!--
            </th>
            -->
    <% 
                        }
                    }
                }
    %>
        <!--
        </tr> 
    </thead>
        --> 
    <tbody>
    <%   
                foreach (DBManager.OutputDesign output in group.outputDesignList)
                {
          
    %>
        <tr> 
        <td>
    <%: output.FieldDescription%></td> 

    <%
                    if (output.OutputColumnList.Count > 0 )
                    {
                        //foreach (DBManager.OutputColumn col in output.OutputColumnList)
                        {
                            List<DBManager.OutputValue> outputValueList = DBManager.DBManager.Instance.GetOutputValuesList(calc.CalculationID, output.FieldID, myOrderId);
                            foreach (DBManager.OutputValue outputV in outputValueList)
                            {
    %>
        <td>

    <% 
                                //if (input.ListID == null)  
                                { 
    %>
    <%//: Html.TextBox(input.FieldID, input.DefaultValue, input.DefaultValue)%>
    <%: Html.Label(outputV.OutputValue1)%>

    <% 
                                }
                            }
    %>
        </td>
    <%  
                        } 
                    } 
                    else 
                    { 
    %>
        <td>
    
   <%                       //if (input.ListID == null)
                            { 
    %>
    <%//: Html.TextBox(input.FieldID, input.DefaultValue, input.DefaultValue)%>

    <% 
                            }
    %>
        </td>
    <%
                    }     
    %>
        </tr>
    <%
                }
    %>
    </tbody> 
    </table> 
</li>
    <% 
           }
    %>         
                </ul>
    <%
       }
    %>
    
</asp:Content>